home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: Aug 15 1996
- //
- // Description:
- // This file creates the window menu
- //
-
- // This string points to the relationship editor pulldown menu in the
- // main window. If plugins add new tasks, they can add their popup menu
- // items to this menu.
- global string $relationshipEditorPulldownMenu = "";
-
- // These strings point to procedures for adding and removing tasks to the
- // relationship editor. They are managed by the relationshipEditorRegisterTask
- // global procedure that plugin writers can call.
- global string $relationshipEditorRegisterCB[] = {};
- global string $relationshipEditorUnregisterCB[] = {};
-
- global proc string[] getRelationshipEdPopups()
- //
- // Description:
- // This procedure finds and returns the popup task menu for all relationship
- // editors. This list is used to allow plugins to register their own tasks.
- //
- {
- string $popups[];
- string $controls[] = `lsUI -long -controls`;
-
- // Look for controls whose leaf name is "taskPopup".
- for ($c in $controls) {
- string $tokens[];
- int $numTokens = `tokenize $c "|" $tokens`;
- if ($tokens[$numTokens-1] == "taskPopup")
- $popups[size($popups)] = $c;
- }
-
- return $popups;
- }
-
- global proc int relationshipEditorRegisterTask(
- string $registerCB,
- string $unregisterCB)
- //
- // Description:
- // This procedure saves the two callbacks for registering and unregistering
- // a task for the relationship editor. The callbacks are used to add and
- // remove the popup UI which makes the tasks visible to the user. An id
- // number is returned to the caller to use when unregistering the task.
- //
- {
- global string $relationshipEditorPulldownMenu;
- global string $relationshipEditorRegisterCB[];
- global string $relationshipEditorUnregisterCB[];
-
- // Use the next available index as the id.
- int $id = size($relationshipEditorRegisterCB);
-
- // Store the callback procedures.
- $relationshipEditorRegisterCB[$id] = $registerCB;
- $relationshipEditorUnregisterCB[$id] = $unregisterCB;
-
- // If the main menu pulldown or the relationship editor popup
- // have already been created, call the registerCB.
- if ($relationshipEditorPulldownMenu != "") {
-
- // Call the register CB at least once for the main menu pulldown.
- eval($registerCB + " foo");
-
- // Get the relationship editor task popups and register the plugin
- // UI for each one.
- string $taskPopups[] = getRelationshipEdPopups();
- for ($popup in $taskPopups)
- eval($registerCB + " " + $popup);
- }
-
- return $id;
- }
-
- global proc relationshipEditorUnregisterTask(int $taskId)
- //
- // Description:
- // This procedure unregisters that task specified by the given id.
- //
- {
- global string $relationshipEditorPulldownMenu;
- global string $relationshipEditorRegisterCB[];
- global string $relationshipEditorUnregisterCB[];
-
- // If the task id is not valid, just return.
- if (($taskId < 0) || ($taskId >= size($relationshipEditorRegisterCB)))
- return;
-
- // If the relationship editor or the main window pulldown have been created,
- // call the unregisterCB for each relationship editor.
- if ($relationshipEditorPulldownMenu != "") {
-
- // Call the unregister CB at least once for the main menu pulldown.
- eval($relationshipEditorUnregisterCB[$taskId] + " foo");
-
- // Get the relationship editor task popups and unregister the plugin
- // UI for each one.
- string $taskPopups[] = getRelationshipEdPopups();
- for ($popup in $taskPopups)
- eval($relationshipEditorUnregisterCB[$taskId] + " " + $popup);
- }
-
- // Clear the callback procedures.
- $relationshipEditorRegisterCB[$taskId] = "";
- $relationshipEditorUnregisterCB[$taskId] = "";
- }
-
- global proc addRelationshipEdPluginItems(string $popup)
- //
- // Description:
- // This procedure is called when the relationship editor is built. It
- // creates the UI for any tasks registered by plugins.
- //
- {
- global string $relationshipEditorRegisterCB[];
-
- // Call the register callback for each registered plugin.
- for ($cb in $relationshipEditorRegisterCB) {
- if ($cb != "")
- eval($cb + " " + $popup);
- }
- }
-
- global proc buildObjectEdMenu( string $parent ) {
-
- global string $gCommandWindow;
-
- setParent -m $parent;
-
- if( `menu -q -ni $parent` != 0 ) {
- //
- // Menu is already built - just return
- //
- return;
- }
- menuItem -ecr false -l "Component Editor..."
- -annotation "Component Editor: Edit various component values for the selected object(s)"
- -imageOverlayLabel "CpEd"
- -c "ComponentEditor";
- menuItem -ecr false -l "Attribute Spread Sheet..."
- -annotation "Attribute Spread Sheet: Edit the attributes of the selected object(s)"
- -imageOverlayLabel "SpSh"
- -c "SpreadSheetEditor";
- menuItem -ecr false -l "Connection Editor..."
- -annotation "Connection Editor: Make connections between object attributes"
- -c "ConnectionEditor";
- menuItem -ecr false -l "Visor..."
- -annotation "Visor: Visual organizer that displays images of shading nodes"
- -c "VisorWindow";
-
- // Blind data editor
- menuItem -divider true;
- menuItem -l "Blind Data Editor..."
- -c "BlindDataEditor"
- -ecr false
- -ann "Blind Data Editor: Create blind data types and apply, query, or false color blind data"
- blindDataEditorItem;
-
- menuItem -divider true;
-
- menuItem -ecr false -l "Channel Control..."
- -annotation "Channel Control: Set the keyable state of attributes of the selected object(s)"
- -c "ChannelControlEditor";
- // menuItem -l "Panel Camera Attributes..." -c "showPanelCameraEditor \"\"";
-
- menuItem -divider true;
-
- menuItem -ecr false -l "Script Editor..."
- -annotation "Script Editor: Enter Maya Embedded Language (MEL) commands"
- -c "ScriptEditor";
- if (!`about -mac`) {
- menuItem -ecr false -l "Command Shell..."
- -annotation "Command Shell: Open a Command Shell window to enter MEL commands one line at a time"
- -c "CommandShell";
- }
- }
-
- global proc buildRenderingEdMenu( string $parent ) {
-
- popupMenu -e -deleteAllItems $parent;
- setParent -m $parent;
-
- if( `menu -q -ni $parent` != 0 ) {
- //
- // Menu is already built - just return
- //
- return;
- }
- menuItem -ecr false -l "Render View..."
- -annotation "Render View: Display rendering image"
- -c "RenderViewWindow";
-
- if (`licenseCheck -m "edit" -typ "complete"`) {
- menuItem -ecr false -l "Hardware Render Buffer..."
- -annotation "Hardware Render Buffer: Display the scene through the camera selected for hardware rendering"
- -c "HardwareRenderBuffer";
- }
-
- menuItem -divider true;
-
- // Create a render globals menu item for each available renderer
- //
- string $renderers[] = `renderer -query -namesOfAvailableRenderers`;
- string $rendererUIName = "";
- string $command = "displayRenderGlobalsWindow";
-
- if ($command != "")
- {
- menuItem
- -enableCommandRepeat false
- -label ("Render Globals ...")
- -annotation "Render Globals: Change global rendering attributes"
- -command $command;
- }
-
- menuItem -ecr false -l "Hypershade..."
- -annotation "Hypershade: Display and edit connections in shading networks"
- -imageOverlayLabel "Hshd"
- -c "HypershadeWindow";
-
- menuItem -divider true;
-
- menuItem -ecr false -l "Rendering Flags..."
- -annotation "Rendering Flags: Change the rendering preferences"
- -c "RenderFlagsWindow";
- menuItem -ecr false -l "Shading Group Attributes..."
- -annotation "Shading Group Attributes: Object by object shader properties"
- -c "ShadingGroupAttributeEditor";
-
- menuItem -divider true;
-
- menuItem -ecr false -l "Multilister..."
- -annotation "Multilister: Create and edit shading nodes, and assign them to objects in your scene"
- -c "Multilister";
-
- menuItem -divider true;
-
- // Create renderer specific submenus for any additional renderers installed
-
- for ($i = 0; $i < size($renderers); $i += 1)
- {
- $command = `renderer -query -renderingEditorsSubMenuProcedure $renderers[$i]`;
-
- if($command != "")
- {
- $rendererUIName = `renderer -query -rendererUIName $renderers[$i]`;
-
- menuItem
- -subMenu true
- -label $rendererUIName
- -annotation
- "Additional renderer specific option"
- ("rendererOptionsItem" + $renderers[$i]);
-
- menuItem
- -edit
- -postMenuCommand
- ("eval " + $command +
- " rendererOptionsItem" + $renderers[$i])
- ("rendererOptionsItem" + $renderers[$i]);
-
- setParent -menu ..;
- }
- }
- }
-
- global proc buildAnimationEdMenu( string $parent ) {
- setParent -m $parent;
- int $completeLicense = `licenseCheck -m "edit" -typ "complete"`;
-
- if( `menu -q -ni $parent` != 0 ) {
- //
- // Menu is already built - just return
- //
- return;
- }
- menuItem -ecr false -l "Graph Editor..."
- -annotation "Graph Editor: Edit animation curves"
- -c "GraphEditor";
-
- menuItem -ecr false -l "Trax Editor..."
- -annotation "Trax Editor: Non-Linear Character Animation Editor"
- -c "CharacterAnimationEditor";
-
- menuItem -ecr false -l "Dope Sheet..."
- -annotation "Dope Sheet: Perform high-level timing and animation event and sound synchronization editing"
- -c "DopeSheetEditor";
-
- if ($completeLicense) {
- menuItem -ecr false -l "Blend Shape..."
- -annotation "Blend Shape: Adjust Blend Shape weights"
- -imageOverlayLabel "Blnd"
- -c "BlendShapeEditor";
- }
-
- menuItem -divider true;
- menuItem -ecr false -l "Expression Editor..."
- -annotation "Expression Editor: Edit expressions between attributes"
- -c "ExpressionEditor" expressionItem;
-
- if(!`about -mac`){
- menuItem -divider true;
- menuItem -ecr false -l "Device Editor..."
- -annotation "Device Editor: Attach input devices to commands or objects"
- -c "DeviceEditor";
- }
- }
-
- global proc buildLightLinkingEdMenu( string $parent ) {
- setParent -m $parent;
-
- if( `menu -q -ni $parent` != 0 ) {
- //
- // Menu is already built - just return
- //
- return;
- }
- menuItem -ecr false -l "Light-Centric..."
- -annotation "Light-Centric Light Linking: Specify the object(s) illuminated by particular lights"
- -c "LightCentricLightLinkingEditor";
- menuItem -ecr false -l "Object-Centric..."
- -annotation "Object-Centric Light Linking: Specify which light(s) illuminate particular geometry"
- -c "ObjectCentricLightLinkingEditor";
- }
-
- global proc buildUvLinkingEdMenu( string $parent ) {
- global string $uvMainLinkMenu;
- global string $furUVLinkMenuItem;
- $uvMainLinkMenu = $parent;
-
- setParent -m $parent;
-
- if( `menu -q -ni $parent` != 0 ) {
- //
- // Menu is already built - just return
- //
- return;
- }
- menuItem -ecr false -l "Texture-Centric..."
- -annotation "Texture-Centric UV Linking: Specify which UV set is used by a particular texture"
- -c "TextureCentricUVLinkingEditor";
- menuItem -ecr false -l "UV-Centric..."
- -annotation "UV-Centric UV Linking: Specify which textures use a particular UV set"
- -c "UVCentricUVLinkingEditor";
-
- //Maya Fur Plugin Fur/UV Linking Menu
- if (`pluginInfo -q -l Fur`) {
- $furUVLinkMenuItem = `menuItem -ecr false -l "Fur/UV..."
- -annotation (getRunTimeCommandAnnotation("FurUVSetLinkingEditor"))
- -c "FurUVSetLinkingEditor"`;
- }
- }
-
- global proc buildRelationshipEdMenu( string $parent )
- {
- // Make the parent menu available to plugins who want to add their own
- // relationships. This variable is defined in relationshipEditor.mel.
- global string $relationshipEditorPulldownMenu;
- $relationshipEditorPulldownMenu = $parent;
-
- setParent -m $parent;
-
- if( `menu -q -ni $parent` != 0 ) {
- //
- // Menu is already built - just return
- //
- return;
- }
- menuItem -ecr false -l "Sets..."
- -annotation "Set Editor: Edit set membership"
- -c "SetEditor";
- menuItem -ecr false -l "Deformer Sets..."
- -annotation "Deformer Set Editor: Edit deformer set membership"
- -c "DeformerSetEditor";
-
- menuItem -ecr false -l "Character Sets..."
- -annotation "Character Set Editor: Edit character set membership"
- -c "CharacterSetEditor";
-
- menuItem -ecr false -l "Partitions..."
- -annotation "Partition Editor: Edit partition membership"
- -c "PartitionEditor";
- menuItem -ecr false -l "Display Layers..."
- -annotation "Layer Editor: Edit display layer membership"
- -c "LayerRelationshipEditor";
- menuItem -ecr false -l "Render Layers..."
- -annotation "Render Layer Editor: Edit render layer membership"
- -c "RenderLayerRelationshipEditor";
- if( `licenseCheck -m edit -type complete` == 1 )
- {
- menuItem -ecr false -l "Dynamic Relationships..."
- -annotation "Dynamic Relationships: Edit dynamic connections to the objects"
- -c "DynamicRelationshipEditor";
- }
-
- $menu = `menuItem -l "Light Linking" -sm true -to true`;
- menu -e -pmc ( "buildLightLinkingEdMenu " + $menu ) $menu;
- setParent -m $parent;
-
- $menu = `menuItem -l "UV Linking" -sm true -to true`;
- menu -e -pmc ( "buildUvLinkingEdMenu " + $menu ) $menu;
- setParent -m $parent;
-
- // Add any items from plugins.
- addRelationshipEdPluginItems("foo");
- }
-
- global proc buildSettingsMenu( string $parent )
- {
- setParent -m $parent;
-
- if( `menu -q -ni $parent` != 0 ) {
- //
- // Menu is already built - just return
- //
- return;
- }
-
- menuItem -ecr false -label "Preferences..."
- -annotation "Preferences: Set and save Maya preferences"
- -c "PreferencesWindow";
- menuItem -ecr false -l "Tool Settings..."
- -annotation "Tool Settings: Edit settings for current tool"
- -c "ToolSettingsWindow";
- menuItem -ecr false -l "Performance Settings..."
- -annotation "Performance Settings: Edit settings affecting scene evaluation"
- -c "PerformanceSettingsWindow";
-
- menuItem -divider true;
-
- menuItem -ecr false -label "Hotkeys..."
- -annotation "Hotkey Preferences: Create, edit and save hotkeys"
- -c "HotkeyPreferencesWindow";
-
- menuItem -ecr false -label "Colors..."
- -annotation "Color Preferences: Set colors for the Maya UI"
- -c "ColorPreferencesWindow";
-
- menuItem -ecr false -l "Marking Menus..."
- -annotation "Marking Menu Editor: Customize the layout of the Marking Menus"
- -c "MarkingMenuPreferencesWindow";
-
- menuItem -ecr false -l "Shelves..."
- -annotation "Shelf Editor: Edit the contents of the Shelf"
- -c "ShelfPreferencesWindow" shelfOptionsItem;
-
- menuItem -ecr false -l "Panels..."
- -annotation "Panel Editor: Edit the Panel Layout"
- -c "PanelPreferencesWindow";
-
- menuItem -divider true;
-
- menuItem -ecr false -l "Plug-in Manager..."
- -annotation "Plug-in Manager: Load or automatically load plug-ins"
- -c "PluginManager";
- }
-
- global proc openAEWindow( )
- //
- // Description:
- // Opens an AE window, IF the attribute editor isn't
- // in the main Maya window pane already.
- //
- {
- global string $gAttributeEditorForm;
-
- if( !`isAttributeEditorVisible` ) {
-
- editSelected;
-
- } else {
- if ( `optionVar -q aeInMainWindow` ){
- string $errorMessage =
- "The Attribute Editor is already in the main Maya window.\n"
- + "// To put the Attribute Editor in a separate window you must:\n"
- + "// - Open \"Window > Settings/Preferences > Preferences\"\n"
- + "// - Turn on the option \"Open Attribute Editor In Separate Window\"\n"
- + "// - Reselect \"Window > Attribute Editor\"\n//\n"
- + "// Cannot open AE: Open Script Editor for more information.";
- warning ( $errorMessage );
- } else {
- // Take the attribute editor out of the main window
- //
- setAttributeEditorVisible(0);
- eval("openAEWindow"); // to prevent circular reference
- }
- }
- }
-
- global proc WindowMenu( string $parent ) {
-
- setParent -m $parent;
- global string $gMiInteractionEditorMenuParent;
- global string $gMiInteractionEditorMenuAfter;
-
- $gMiInteractionEditorMenuParent = $parent;
-
- string $menu = `menuItem -l "General Editors" -sm true -to true`;
- menu -e -pmc ( "buildObjectEdMenu " + $menu ) $menu;
- setParent -m $parent;
- $menu = `menuItem -l "Rendering Editors" -sm true -to true`;
- menu -e -pmc ( "buildRenderingEdMenu " + $menu ) $menu;
- setParent -m $parent;
- $menu = `menuItem -l "Animation Editors" -sm true -to true`;
- menu -e -pmc ( "buildAnimationEdMenu " + $menu ) $menu;
- setParent -m $parent;
- $menu = `menuItem -l "Relationship Editors" -sm true -to true`;
- menu -e -pmc ( "buildRelationshipEdMenu " + $menu ) $menu;
- setParent -m $parent;
- $menu = `menuItem -l "Settings/Preferences" -sm true -to true`;
- menu -e -pmc ( "buildSettingsMenu " + $menu ) $menu;
- setParent -m $parent;
-
- menuItem -divider true;
-
- menuItem -ecr false -l "Attribute Editor..."
- -annotation "Attribute Editor: Edit the attributes of the selected object"
- -c "AttributeEditor";
- menuItem -ecr false -l "Outliner..."
- -annotation "Outliner: List the objects in the scene"
- -c "OutlinerWindow";
- menuItem -ecr false -l "Hypergraph..."
- -annotation "Hypergraph: Display and edit relationships among nodes in your scene graphically"
- -imageOverlayLabel "Hgph"
- -c "HypergraphWindow";
-
- menuItem -divider true;
-
- if (`licenseCheck -m "edit" -typ "particlePaint"`) {
- menuItem -ecr false -l "Paint Effects..."
- -annotation "Paint Effects: A 2D/3D paint system using connected particles to produce effects"
- -c "PaintEffectsWindow";
- } else {
- menuItem -ecr false -l "Paint Effects..."
- -annotation "Paint Effects: A 2D paint system"
- -c "PaintEffectsWindow";
- }
-
- $gMiInteractionEditorMenuAfter = `menuItem -ecr false -l "UV Texture Editor..."
- -annotation "UV Texture Editor: Texture coordinate mapping view"
- -c "TextureViewWindow"`;
-
- if( `isTrue AnimationExists` ) {
- menuItem -divider true;
- menuItem -l "Playblast..."
- -annotation "Playblast: Preview animation by screen-capturing frames"
- -c "PlayblastWindow" playblastItem;
- menuItem -optionBox true
- -annotation "Playblast Option Box"
- -l "Playblast Option Box" -c "PlayblastOptions" playblastDialogItem;
- }
- }
-